<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>美兰数据文化馆与图书馆</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
</head>
<style>
    /* 底部固定区域 */
    .layui-layout-admin .layui-footer {
        padding: 10px 0;
        text-align: center;
    }

    .layui-layout-admin .layui-footer {
        background-color: #fff;
    }


    #Images li {
        float: left;
        margin: 0.5%;
        overflow: hidden;
        width: 19%;
    }

    #Images li img {
        cursor: pointer;
        width: 100%;
    }

    #Images li .operate {
        background: #f4f5f9 none repeat scroll 0 0;
        display: block;
        height: 40px;
        width: 100%;
    }

    #Images li .operate .check {
        float: left;
        height: 18px;
        margin-left: 11px;
        padding: 11px 0;
        position: relative;
        width: 74%;
    }

    #Images li .operate .check .layui-form-checkbox[lay-skin="primary"] {
        width: 100%;
    }

    #Images li .operate .check .layui-form-checkbox[lay-skin="primary"] span {
        box-sizing: border-box;
        padding: 0 5px 0 25px;
        width: 100%;
    }

    #Images li .operate .check .layui-form-checkbox[lay-skin="primary"] i {
        left: 0;
        position: absolute;
        top: 0;
    }

    #Images li .operate .img_del {
        cursor: pointer;
        float: right;
        font-size: 22px !important;
        margin: 9px 11px 0 0;
    }

    #Images li .operate .img_del:hover {
        color: #f00;
    }
    .layui-form-label {
        width: 110px;
    }
    .layui-input-block {
        margin-left: 140px;
    }

</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 0px;">
            <form class="layui-form" lay-filter="component-form-element">
                <div class="layui-tab layui-tab-brief" lay-filter="component-tabs-hash">
                    <div class="layui-tab-content">
                        <div class="layui-tab-item  layui-show">
                            <div class="layui-form-item">
                                <label class="layui-form-label">图片匹配不成功</label>
                                <div class="layui-input-block">
                                      <textarea class="layui-textarea" name="feedback"
                                                id="imagename"></textarea>
                                </div>
                            </div>
                            <blockquote class="layui-elem-quote news_search">
                                <div class="layui-inline">
                                    <a class="layui-btn layui-btn-sm uploadNewImg"><i class="layui-icon"></i>上传图片</a>
                                </div>
                            </blockquote>
                            <ul class="layer-photos-demo" id="Images"></ul>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin">

                </div>
            </form>
        </div>
    </div>
</div>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script>
    layui.use(['form', 'laydate', 'upload'], function () {
        var $ = layui.$
            , form = layui.form
            , laydate = layui.laydate
            , layer = layui.layer,
            upload = layui.upload;

        //多图片上传
        upload.render({
            elem: '.uploadNewImg',
            url: '<%=request.getContextPath()%>/rest/rfid/imageBatchProduct',
            multiple: true,
            accept: "images",
            size: 5120,
            before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            },
            done: function (res) {
                if (res.code == 0) {
                    if (res.count != 0) {
                        $('#Images').prepend('<li><img layer-src="' + res.data.src + '" src="' + res.data.src + '" class="layui-upload-img" height="253px;" ></li>')
                        form.render("checkbox");
                    } else {
                        var imagename = $("#imagename").html();
                        if (imagename == "") {
                            $("#imagename").html(res.errorImages.imagename)
                        } else {
                            $("#imagename").html(imagename + "," + res.errorImages.imagename)
                        }
                    }
                }
            }
            , error: function (index, upload) {
            }
        });
    });
</script>
</body>
</html>